<?php include_once './application/views/sys_admin/common/header.php';  ?>
<!-- admin_main -->
<div class="admin_main">
	<!-- Admin_top end -->
	<?php include_once './application/views/sys_admin/common/borrow_left.php';  ?>
	<!-- Admin_Left End -->
	<div class="admin_right">
		<div class="admin_right_title">
			<strong>贷款管理</strong> &gt;&gt;  投票记录
		</div>
		<form id="tmpform">
		<input type="hidden" id="tid" name="tid">
		</form>
		<div class="admin_right_con">
			<table border="0" cellspacing="1" cellpadding="0">
			  <tr style="color:#0068b7;">
				<td height="35" align="center" valign="middle" bgcolor="#F1F1F1"><strong>编号</strong></td>
				<td height="35" align="center" valign="middle" bgcolor="#F1F1F1"><strong>投资客</strong></td>
				<td height="35" align="center" valign="middle" bgcolor="#F1F1F1"><strong>借款标</strong></td>
				<td height="35" align="center" valign="middle" bgcolor="#F1F1F1"><strong>投标金额</strong></td>
				<td height="35" align="center" valign="middle" bgcolor="#F1F1F1"><strong>期限</strong></td>
				<td height="35" align="center" valign="middle" bgcolor="#F1F1F1"><strong>状态</strong></td>
				<td height="35" align="center" valign="middle" bgcolor="#F1F1F1"><strong>投标时间</strong></td>
				<td height="35" align="center" valign="middle" bgcolor="#F1F1F1"><strong>操作</strong></td>
			  </tr>
			  <?php foreach($tender_list as $key=>$tender){?>
			  <tr <?php if($tender['flag'] == 1){?>style="color:red"<?php }?>>
				<td height="35" align="center" valign="middle" bgcolor="#FFFFFF"><?php echo $tender['id'];?></td>
				<td height="35" align="center" valign="middle" bgcolor="#FFFFFF"><?php echo $tender['username'];?></td>
				<td height="35" align="center" valign="middle" bgcolor="#FFFFFF"><?php echo $tender['title'];?></td>
				<td height="35" align="center" valign="middle" bgcolor="#FFFFFF"><?php echo number_format($tender['account'],2);?></td>
				<td height="35" align="center" valign="middle" bgcolor="#FFFFFF"><?php echo $tender['time_limit'];?></td>
				<td height="35" align="center" valign="middle" bgcolor="#FFFFFF"><?php echo $borrow_tender_status[$tender['fstatus']];?></td>
				<td height="35" align="center" valign="middle" bgcolor="#FFFFFF"><?php echo date('m-d H:i', $tender['add_time']);?></td>
				<td height="35" align="center" valign="middle" bgcolor="#FFFFFF">
				<?php if ($tender['fstatus']==1 && date('Y-m-d',$tender['add_time'])==date('Y-m-d')){?>
				<!-- <a href="javascript:void(0);" onclick="docancel(<?php echo $tender['id'];?>);">撤销投资</a> -->
				<?php }else{?>
				--
				<?php }?>
				</td>
			  </tr>
			  <?php }?>
			  <tr>
			  	<td height="35" colspan="8" align="right" bgcolor="#FFFFFF">
			  		<form action="/sys_admin/borrow/tenderlist/" method="get">
			  			借款标名称：<input type="text" id="title" name="title" style="width: 200px;" value="<?php echo $title?>" />
			  			用户名称：<input type="text" id="username" name="username" style="width: 100px;" value="<?php echo $username?>" />
			  			是否内部账号：<select id="is_self" name="is_self">
			  				<option value="-1" <?php if($is_self==-1){?>selected="selected"<?php }?>>所有</option>
			  				<?php foreach($user_self as $key=>$value){?>
			  				<option value="<?php echo $key?>" <?php if($is_self==$key){?>selected="selected"<?php }?>><?php echo $value;?></option>
			  				<?php }?>
			  			</select>
			  			状态：<select id="fstatus" name=fstatus>
			  				<option value="-1" <?php if($fstatus==-1){?>selected="selected"<?php }?>>所有</option>
			  				<?php foreach($borrow_tender_status as $key=>$value){?>
			  				<option value="<?php echo $key?>" <?php if($fstatus==$key){?>selected="selected"<?php }?>><?php echo $value;?></option>
			  				<?php }?>
			  			</select>
			  			期限：<select id="time_limit" name="time_limit">
			  				<option value="-1" <?php if($time_limit==-1){?>selected="selected"<?php }?>>所有</option>
			  				<?php foreach($borrow_time_limit as $key=>$value){?>
			  				<option value="<?php echo $key?>" <?php if($time_limit==$key){?>selected="selected"<?php }?>><?php echo $value;?></option>
			  				<?php }?>
			  			</select>
			  			开始时间：<input type="text" id="strtime" name="strtime" size="7" value="<?php echo $strtime;?>"  onfocus="WdatePicker()" />
			  			结束时间：<input type="text" id="endtime" name="endtime" size="7" value="<?php echo $endtime;?>"  onfocus="WdatePicker()" />
			  			<input type="submit"/>
			  		</form>
			  	</td>
			  </tr>
			  <tr>
			  	<td height="35" colspan="6" align="center" bgcolor="#FFFFFF">实际投资人数：<font style="color:red;"><?php echo $user_count?></font>人
			  	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
			  		投资金额：<font style="color:red;"><?php echo number_format($tender_money,2);?></font>元
			  	</td>
			  	<td colspan="2"  height="35" align="right" valign="middle" bgcolor="#FFFFFF"><a href="/sys_admin/borrow/tenderlistexcel?username=<?php echo $username;?>&is_self=<?php echo $is_self;?>&fstatus=<?php echo $fstatus;?>&title=<?php echo $title;?>&time_limit=<?php echo $time_limit;?>&strtime=<?php echo $strtime;?>&endtime=<?php echo $endtime;?>">导出数据</a></td>
			  </tr>
			  <tr>
			  	<td colspan="8"  height="35" align="center" valign="middle" bgcolor="#FFFFFF" class="page"><?php echo $this->pagination->create_links();?>共<?php echo $tender_count;?>条记录</td>
			  </tr>
			</table>
			</div>
	</div>
<!-- Admin_Right End -->
</div>
<!-- admin_main end -->
<div id="dialog" title="系统提示" style="display:none"><p id="msg" style="text-align:center"></p></div>
</body>
<script>
function docancel(tender_id){
	$('#dialog').dialog({
		modal:true,
		title:'系统提示',
		buttons:{"确定":function(){canceltender(tender_id);},"取消":function(){$(this).dialog("close");}},
	});
	$("#msg").html("该操作牵涉到用户资金，是否确认？");
}

function canceltender(tender_id){
	$("#tid").val(tender_id);
	var options = {
		url : '/sys_admin/borrow/cancel_tender/',
		dataType: "text",
		type:"post",
		success : function(ret) {
		$('#dialog').dialog({
			modal:true,
			title:'系统提示',
			buttons:{"确定":function(){$(this).dialog("close");}},
			close: function() {
				location.reload();
			}
		});
		$("#msg").html(ret);
		}
	};
	$("#tmpform").ajaxSubmit(options);
	return false;
}
</script>
</html>
